package com.sharding.jdbc.entity;

import java.io.Serializable;
import java.math.BigDecimal;

public class Order implements Serializable {
    private Integer id;

    private BigDecimal orderAmount;

    private Integer orderStatus;

    private Integer userId;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(BigDecimal orderAmount) {
        this.orderAmount = orderAmount;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Order other = (Order) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals( other.getId() ))
                && (this.getOrderAmount() == null ? other.getOrderAmount() == null : this.getOrderAmount().equals( other.getOrderAmount() ))
                && (this.getOrderStatus() == null ? other.getOrderStatus() == null : this.getOrderStatus().equals( other.getOrderStatus() ))
                && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals( other.getUserId() ));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOrderAmount() == null) ? 0 : getOrderAmount().hashCode());
        result = prime * result + ((getOrderStatus() == null) ? 0 : getOrderStatus().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append( getClass().getSimpleName() );
        sb.append( " [" );
        sb.append( "Hash = " ).append( hashCode() );
        sb.append( ", id=" ).append( id );
        sb.append( ", orderAmount=" ).append( orderAmount );
        sb.append( ", orderStatus=" ).append( orderStatus );
        sb.append( ", userId=" ).append( userId );
        sb.append( ", serialVersionUID=" ).append( serialVersionUID );
        sb.append( "]" );
        return sb.toString();
    }
}